/*
 * @Author: huangrongji
 * @Date: 2021-01-28 22:09:27
 * @LastEditors: huangrongji
 * @LastEditTime: 2021-01-29 22:38:01
 * @Description: file content
 * @FilePath: \news_testd:\工作空间\workspace\repair\custom-tab-bar\index.js
 */
Component({
	data: {
		active: 0,
		list: [
			{
				text: '报修',
				url: '/pages/Index/Index/index',
				normal: 'https://light-year-1258515630.cos.ap-guangzhou.myqcloud.com/repair-mp/images/tabbar/white/%E5%AF%BC%E8%88%AA%E6%A0%8F-%E6%8A%A5%E4%BF%AE.svg',
				active:'https://light-year-1258515630.cos.ap-guangzhou.myqcloud.com/repair-mp/images/tabbar/green/%E5%AF%BC%E8%88%AA%E6%A0%8F-%E6%8A%A5%E4%BF%AE.svg'
			},
			{
				text: '报修进度',
				url: '/pages/RepairProgressPages/Index/index',
				normal: 'https://light-year-1258515630.cos.ap-guangzhou.myqcloud.com/repair-mp/images/tabbar/white/%E5%AF%BC%E8%88%AA%E6%A0%8F-%E6%8A%A5%E4%BF%AE%E8%BF%9B%E5%BA%A6.svg',
				active:'https://light-year-1258515630.cos.ap-guangzhou.myqcloud.com/repair-mp/images/tabbar/green/%E5%AF%BC%E8%88%AA%E6%A0%8F-%E6%8A%A5%E4%BF%AE%E8%BF%9B%E5%BA%A6-%E7%BB%BF%E5%BA%95.svg'

			},
			{
				text: '我的',
				url: '/pages/User/Index/index',
				normal: 'https://light-year-1258515630.cos.ap-guangzhou.myqcloud.com/repair-mp/images/tabbar/white/%E5%AF%BC%E8%88%AA%E6%A0%8F-%E6%88%91%E7%9A%84%20%E8%81%8A%E5%A4%A9-%E8%A1%A8%E6%83%85.svg',
				active:'https://light-year-1258515630.cos.ap-guangzhou.myqcloud.com/repair-mp/images/tabbar/green/%E5%AF%BC%E8%88%AA%E6%A0%8F-%E6%88%91%E7%9A%84-%E7%BB%BF%E5%BA%95.svg'

			}
		]
	},

	methods: {
		onChange(event) {
			this.setData({ active: event.detail });
			wx.switchTab({
				url: this.data.list[event.detail].url
			});
		},

		init() {
			const page = getCurrentPages().pop();
			this.setData({
				active: this.data.list.findIndex(item => item.url === `/${page.route}`)
			});
		}
	}
});
